function setDOMInfo(info) {
	browser_name = info[1];
	browser_version = info[2];

	if ((info[5] === null) && (info[6] === null) && (info[3] === null)) {
		document.querySelector(".warningMessage").innerHTML = "Unable to process now";
		document.getElementById('inputXPath').value = "";
		document.getElementById('inputVersion').value = "";
		document.getElementById('inputWinTitle').value = "";
		document.getElementById('inputPageTitle').value = "";
		document.getElementById('inputEleName').value = "";
		document.getElementById('inputIframe').value = "";
		return;
	} else {

		try {
			document.querySelector(".warningMessage").innerHTML = ""
		} catch (err) {}

	}

	try {
		document.getElementById('inputXPath').value = info[0];
		document.getElementById('inputVersion').value = info[4];
		document.getElementById('inputWinTitle').value = info[7];
		document.getElementById('inputPageTitle').value = info[5];
		document.getElementById('inputEleName').value = info[6];
		document.getElementById('inputIframe').value = info[3];
		insertNewRow();
	} catch (err) {}
}

chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
	if (request.xpath == undefined) {
		return
	}
	var xpath = request.xpath.split("@@@@")[0];
	var winTitle = request.xpath.split("@@@@")[5];
	var pageTitle = request.xpath.split("@@@@")[1];
	var name = request.xpath.split("@@@@")[2];
	var isInFrame = request.xpath.split("@@@@")[3];
	var iFrameUrl = request.xpath.split("@@@@")[4];

	if ((pageTitle === "undefined") && (name === "undefined") && (iFrameUrl === "undefined")) {
		document.querySelector(".warningMessage").innerHTML = "Unable to process now";
		document.getElementById('inputXPath').value = "";
		document.getElementById('inputVersion').value = "";
		document.getElementById('inputWinTitle').value = "";
		document.getElementById('inputPageTitle').value = "";
		document.getElementById('inputEleName').value = "";
		document.getElementById('inputIframe').value = "";
		return;
	} else {
		try {
			document.querySelector(".warningMessage").innerHTML = ""
		} catch (err) {}
	}

	try {
		document.getElementById('inputWinTitle').value = winTitle;
		document.getElementById('inputPageTitle').value = pageTitle;
		document.getElementById('inputEleName').value = name;
		document.getElementById('inputXPath').value = xpath;
		document.getElementById('inputVersion').value = "";
		document.getElementById('inputIframe').value = iFrameUrl;
		insertNewRow();
	} catch (err) {}
});

document.addEventListener('DOMContentLoaded', function() {
	chrome.runtime.sendMessage({
		from: 'popup',
		subject: 'DOMInfo'
	}, setDOMInfo);
	try {
		document.querySelector("#copyXPath").addEventListener("click", copyXPath);
		document.querySelector("#copyEleName").addEventListener("click", copyEleName);
		document.querySelector("#copyWinTitle").addEventListener("click", copyWinTitle);
		document.querySelector("#copyPageTitle").addEventListener("click", copyPageTitle);
		document.querySelector("#copyVersion").addEventListener("click", copyVersion);
		document.querySelector("#copyIframe").addEventListener("click", copyFrameUrl);
		document.querySelector("#add").addEventListener("click", insertNewRow);
		document.querySelector("#add2").addEventListener("click", insertNewRow);
		document.querySelector("#imp").addEventListener("click", downloadOption);
		document.querySelector("#delBtn").addEventListener("click", deleles);
		document.querySelector("#selectAll").addEventListener("click", checkUncheckAll);
		document.querySelector("#edit").addEventListener("click", editInfo);
		document.querySelector("#save").addEventListener("click", saveInfo);
		document.querySelector("#push").addEventListener("click", pushInfo);


		var copyXPathBtn = document.getElementById("copyXPath");
		copyXPathBtn.addEventListener("mouseover", function() {
			buttonMouseHover(copyXPathBtn)
		});
		copyXPathBtn.addEventListener("mouseout", function() {
			buttonMouseOut(copyXPathBtn)
		});

		var copyEleNameBtn = document.getElementById("copyEleName");
		copyEleNameBtn.addEventListener("mouseover", function() {
			buttonMouseHover(copyEleNameBtn)
		});
		copyEleNameBtn.addEventListener("mouseout", function() {
			buttonMouseOut(copyEleNameBtn)
		});

		var copyWinTitleBtn = document.getElementById("copyWinTitle");
		copyWinTitleBtn.addEventListener("mouseover", function() {
			buttonMouseHover(copyWinTitleBtn)
		});
		copyWinTitleBtn.addEventListener("mouseout", function() {
			buttonMouseOut(copyWinTitleBtn)
		});

		var copyPageTitleBtn = document.getElementById("copyPageTitle");
		copyPageTitleBtn.addEventListener("mouseover", function() {
			buttonMouseHover(copyPageTitleBtn)
		});
		copyPageTitleBtn.addEventListener("mouseout", function() {
			buttonMouseOut(copyPageTitleBtn)
		});

		var copyVersionBtn = document.getElementById("copyVersion");
		copyVersionBtn.addEventListener("mouseover", function() {
			buttonMouseHover(copyVersionBtn)
		});
		copyVersionBtn.addEventListener("mouseout", function() {
			buttonMouseOut(copyVersionBtn)
		});

		var copyIframeBtn = document.getElementById("copyIframe");
		copyIframeBtn.addEventListener("mouseover", function() {
			buttonMouseHover(copyIframeBtn)
		});
		copyIframeBtn.addEventListener("mouseout", function() {
			buttonMouseOut(copyIframeBtn)
		});

		var imp = document.getElementById("imp");
		imp.addEventListener("mouseover", function() {
			buttonMouseHover(imp)
		});
		imp.addEventListener("mouseout", function() {
			buttonMouseOut(imp)
		});

		var delBtn = document.getElementById("delBtn");
		delBtn.addEventListener("mouseover", function() {
			buttonMouseHoverRed(delBtn)
		});
		delBtn.addEventListener("mouseout", function() {
			buttonMouseOut(delBtn)
		});

		var edit = document.getElementById("edit");
		edit.addEventListener("mouseover", function() {
			buttonMouseHoverYello(edit)
		});
		edit.addEventListener("mouseout", function() {
			buttonMouseOut(edit)
		});

		var save = document.getElementById("save");
		save.addEventListener("mouseover", function() {
			buttonMouseHover(save)
		});
		save.addEventListener("mouseout", function() {
			buttonMouseOut(save)
		});

		var push = document.getElementById("push");
		push.addEventListener("mouseover", function() {
			buttonMouseHover(push)
		});
		push.addEventListener("mouseout", function() {
			buttonMouseOut(push)
		});

		var add = document.getElementById("add");
		add.addEventListener("mouseover", function() {
			buttonMouseHover(add)
		});
		add.addEventListener("mouseout", function() {
			buttonMouseOut(add)
		});

		var add2 = document.getElementById("add2");
		add2.addEventListener("mouseover", function() {
			buttonMouseHover(add2)
		});
		add2.addEventListener("mouseout", function() {
			buttonMouseOut(add2)
		});

		var downloadtype = document.getElementById("downloadtype");
		downloadtype.addEventListener("mouseover", function() {
			buttonMouseHover(downloadtype)
		});
		downloadtype.addEventListener("mouseout", function() {
			buttonMouseOut(downloadtype)
		});

		//display&hide export message
		/*chrome.storage.local.get("ExportOptionVisible", function(result) {
		  if (result.ExportOptionVisible == undefined) {
		    document.getElementById("Exportlbl").hidden = false;
		  }
		  if (result.ExportOptionVisible == true) {
		    document.getElementById("Exportlbl").hidden = true;
		  }});*/

	} catch (err) {}
});

/************************Copy Data from Textboxes*************************** */
function copyWinTitle() {
	var copyText = document.querySelector("#inputWinTitle");
	copyText.select();
	document.execCommand("copy");
}

function copyPageTitle() {
	var copyText = document.querySelector("#inputPageTitle");
	copyText.select();
	document.execCommand("copy");
}

function copyFrameUrl() {
	var copyText = document.querySelector("#inputIframe");
	copyText.select();
	document.execCommand("copy");
}

function copyEleName() {
	var copyText = document.querySelector("#inputEleName");
	copyText.select();
	document.execCommand("copy");
}

function copyXPath() {
	var copyText = document.querySelector("#inputXPath");
	copyText.select();
	document.execCommand("copy");
}

function copyVersion() {
	var copyText = document.querySelector("#inputVersion");
	copyText.select();
	document.execCommand("copy");
}
/******************************************************************************************* */
//////////////////////////////////////////////////////////////////////////////////////////////
function deleles() {
	var selectAllCheckbox = document.getElementById("selectAll");
	var checks = document.getElementsByName("eles");
	if ((document.querySelectorAll('input[type="checkbox"]:checked').length) < 1) {
		alert("Please select the row to delete")
		return;
	}

	if (confirm("Are you sure to delete?")) {
		for (i = 0; i < checks.length; ++i) {
			if (checks[i].checked) {
				// console.log("checks[i].value"+ checks[i].value)
				deleteSelectedRow(checks[i].value)
				i = 0;
			}
		}
	}

	if (selectAllCheckbox.checked == true) {
		selectAllCheckbox.checked = false;
	}
}

function del0() {
	deleteSelectedRow(0);
}

function deleteSelectedRow(rowID) {
	$("#" + rowID).remove();
}


function checkUncheckAll() {
	var selectAllCheckbox = document.getElementById("selectAll");
	if (selectAllCheckbox.checked == true) {
		var checkboxes = document.getElementsByName("eles");
		for (var i = 1, n = checkboxes.length; i < n; i++) {
			checkboxes[i].checked = true;
		}
	} else {
		var checkboxes = document.getElementsByName("eles");
		for (var i = 1, n = checkboxes.length; i < n; i++) {
			checkboxes[i].checked = false;
		}
	}
}

function AddRow(table, index) {
	var lastRow = table.rows[table.rows.length - 1];
	var newRow = lastRow.cloneNode(true);
	// var startIndex = $.inArray(lastRow,table.rows);
	var startIndex = 3;
	var endIndex = table.rows;
	table.tBodies[0].appendChild(newRow);
	newRow.cells[0].innerHTML = endIndex - startIndex;
	SetRowCanEdit(newRow);
	return newRow;
}

var idTmr;

function getExplorer() {
	var explorer = window.navigator.userAgent;
	//ie
	if (explorer.indexOf("MSIE") >= 0) {
		return 'ie';
	}
	//firefox
	else if (explorer.indexOf("Firefox") >= 0) {
		return 'Firefox';
	}
	//Chrome
	else if (explorer.indexOf("Chrome") >= 0) {
		return 'Chrome';
	}
	//Opera
	else if (explorer.indexOf("Opera") >= 0) {
		return 'Opera';
	}
	//Safari
	else if (explorer.indexOf("Safari") >= 0) {
		return 'Safari';
	}
}

function imp() {
	var rowLength = $("#elemetTable tr").length;
	if (rowLength < 4) {
		alert("No entries in the grid to export this moment")
		return;
	}
	var tableid = 'elemetTable';
	if (getExplorer() == 'ie') {
		var curTbl = document.getElementById(tableid);
		var oXL = new ActiveXObject("Excel.Application");
		var oWB = oXL.Workbooks.Add();
		var xlsheet = oWB.Worksheets(1);
		var sel = document.body.createTextRange();
		sel.moveToElementText(curTbl);
		sel.select();
		sel.execCommand("Copy");
		xlsheet.Paste();
		oXL.Visible = true;
		try {
			var fname = oXL.Application.GetSaveAsFilename("Excel.xls", "Excel Spreadsheets (*.xls), *.xls");
		} catch (e) {
			print("Nested catch caught " + e);
		} finally {
			oWB.SaveAs(fname);
			oWB.Close(savechanges = false);
			oXL.Quit();
			oXL = null;
			idTmr = window.setInterval("Cleanup();", 1);
		}
	} else {
		tableToExcel(tableid)
	}
}

function tableToExcel(table) {
	var uri = 'data:application/vnd.ms-excel;base64,',
		template = '<html><head><meta charset="UTF-8"></head><body><table>{table}</table></body></html>',
		base64 = function(s) {
			return window.btoa(unescape(encodeURIComponent(s)))
		},
		format = function(s, c) {
			return s.replace(/{(\w+)}/g,
				function(m, p) {
					return c[p];
				})
		}
	//return function(table, name) {
	if (!table.nodeType) table = document.getElementById(table)
	var ctx1 = {
		worksheet: name || 'Worksheet',
		table: GetValue()
	}
	window.location.href = uri + base64(format(template, ctx1))
	//}
}

function insertNewRow() {
	var xpath = document.getElementById("inputXPath").value;
	var eleName = document.getElementById("inputEleName").value;
	var winTitle = document.getElementById("inputWinTitle").value;
	var pageTitle = document.getElementById("inputPageTitle").value;
	var version = document.getElementById('inputVersion').value;
	var idOrNames = document.getElementById("inputIframe").value;
	//console.log(xpath + "," + title + "," + inputPageTitle);

	var rowLength = $("#elemetTable tr").length;
	var rowId = "row" + flag;
	var insertStr = "<tr id=" + rowId + ">" +
		"<td style='width: 15%'>" + firstCell + "</td>" +
		"<td style='width: 15%'>" + secondCell + "</td>" +
		"<td style='width: 15%'>" + thirdCell + "</td>" +
		"<td style='width: 15%'>" + fourthCell + "</td>" +
		"<td style='width: 15%'>" + fifthCell + "</td>" +
		"<td style='width: 15%'>" + sixCell + "</td>" +
		"<td style='display:none;'><input class='rowtxt' type='hidden' name='elementBy' style='width:98%' value='XPATH' /></td>" +
		"<td style='width: 10%'><input name='eles' type='checkbox' value=" +
		rowId + " /></td>" +
		"</tr>";
	$("#elemetTable tr:eq(" + (rowLength - 2) + ")").after(insertStr);
	$("#" + rowId + " td:eq(0)").children().eq(0).attr("id", "Win" + flag);
	$("#" + rowId + " td:eq(1)").children().eq(0).attr("id", "Page" + flag);
	$("#" + rowId + " td:eq(2)").children().eq(0).attr("id", "EleName" + flag);
	$("#" + rowId + " td:eq(3)").children().eq(0).attr("id", "Xpath" + flag);
	$("#" + rowId + " td:eq(4)").children().eq(0).attr("id", "Version" + flag);
	$("#" + rowId + " td:eq(5)").children().eq(0).attr("id", "Frame" + flag);
	$("#" + rowId + " td:eq(0)").children().eq(0).attr("value", winTitle);
	$("#" + rowId + " td:eq(1)").children().eq(0).attr("value", pageTitle);
	$("#" + rowId + " td:eq(2)").children().eq(0).attr("value", eleName);
	$("#" + rowId + " td:eq(3)").children().eq(0).attr("value", xpath);
	$("#" + rowId + " td:eq(4)").children().eq(0).attr("value", version);
	$("#" + rowId + " td:eq(5)").children().eq(0).attr("value", idOrNames);
	flag++;
}

function GetValue() {
	var tableH = "<tr><td>Win</td><td>Page</td><td>EleName</td><td>Xpath</td><td>Version</td><td>Frame</td></tr>";
	var value = "";
	$("#elemetTable tr").each(function(i) {
		if (i >= 1) {
			var tableTr = "<tr>";
			$(this).children().each(function(j) {
				if ($("#elemetTable tr").eq(i).children().length - 1 != j) {
					tableTr = tableTr + "<td>";
					value = $(this).children().eq(0).val()
					// value += $(this).children().eq(0).val() + ","
					if ($(this).children().length > 1) {
						value += $(this).children().eq(1).val() + ","
					}
					tableTr = tableTr + value + "</td>";
				}
			});
			value = value.substr(0, value.length - 1) + "#";
			tableTr = tableTr + "</tr>";
			tableH = tableH + tableTr;
		}
	});
	value = value.substr(0, value.length);
	tableH = tableH + ""
	//console.log("--" + tableH);
	//             $("#formvalue").val(value);
	//             $("formvalue").submit();
	return tableH;
}


function editInfo() {
	if ((document.querySelectorAll('input[type="checkbox"]:checked').length) < 1) {
		alert("Please select row to edit")
		return;
	}

	if ((document.querySelectorAll('input[type="checkbox"]:checked').length) > 1) {
		alert("Please select only one row to edit")
		return;
	}
	var checks = document.getElementsByName("eles");
	for (i = 0; i < checks.length; ++i) {
		if (checks[i].checked) {
			editRows(checks[i].value.split("row")[1])
			break;
		}
	}
}
//sumit
function editRows(rowID) {
	document.getElementById("inputWinTitle").value = document.getElementById("Win" + rowID).value;
	document.getElementById("inputPageTitle").value = document.getElementById("Page" + rowID).value;
	document.getElementById("inputEleName").value = document.getElementById("EleName" + rowID).value;
	document.getElementById("inputXPath").value = document.getElementById("Xpath" + rowID).value;
	document.getElementById('inputVersion').value = document.getElementById("Version" + rowID).value;
	document.getElementById("inputIframe").value = document.getElementById("Frame" + rowID).value;
}

function pushInfo() {
	/* 	var data = new Object();
		var dataform = readingDataFrom();
		data.testelementinfos = dataform;
		data.operation=new Object(); */
	var dataform = readingDataFrom();
	pushData(dataform, pushDataCallback);
}

function saveInfo() {
	if ((document.querySelectorAll('input[type="checkbox"]:checked').length) < 1) {
		alert("Please select one row to edit and then save it")
		return;
	}

	if ((document.querySelectorAll('input[type="checkbox"]:checked').length) > 1) {
		alert("Please select one row to edit and then save it")
		return;
	}
	var checks = document.getElementsByName("eles");
	for (i = 0; i < checks.length; ++i) {
		if (checks[i].checked) {
			saveRows(checks[i].value.split("row")[1])
			checks[i].checked = false;
			break;
		}
	}
}

function saveRows(rowID) {
	document.getElementById("Win" + rowID).value = document.getElementById("inputWinTitle").value;
	document.getElementById("Page" + rowID).value = document.getElementById("inputPageTitle").value;
	document.getElementById("EleName" + rowID).value = document.getElementById("inputEleName").value;
	document.getElementById("Xpath" + rowID).value = document.getElementById("inputXPath").value;
	document.getElementById("Version" + rowID).value = document.getElementById('inputVersion').value;
	document.getElementById("Frame" + rowID).value = document.getElementById("inputIframe").value;

	document.getElementById("inputWinTitle").value = "";
	document.getElementById("inputPageTitle").value = "";
	document.getElementById("inputEleName").value = "";
	document.getElementById("inputXPath").value = "";
	document.getElementById('inputVersion').value = "";
	document.getElementById("inputIframe").value = "";
}

setTimeout(function() {

	try {
		var fileTxtBox = document.getElementById("fileTxtBox");
		fileTxtBox.addEventListener("click", function() {
			if (fileTxtBox.value == "Please Write File Name") {
				fileTxtBox.value = "";
			}
		});
	} catch (err) {}

	try {
		var downloadtype = document.getElementById("downloadtype");
		downloadtype.addEventListener("click", function() {
			if ((downloadtype.options[downloadtype.selectedIndex].value == "Excel") || (downloadtype
					.options[downloadtype.selectedIndex].value == "Select")) {
				document.getElementById("fileTxtBox").style.display = 'none';
			} else {
				document.getElementById("fileTxtBox").style.display = 'inline';
			}
		});
	} catch (err) {}


}, 1000);

function txtFileName() {
	return document.getElementById("fileTxtBox").value;
}

function downloadOption() {
	//chrome.storage.local.set({"ExportOptionVisible": true});
	var selectDownload = document.getElementById('downloadtype');
	var opt = selectDownload.options[selectDownload.selectedIndex];
	switch (opt.value) {
		case "Select":
			alert("Please select one of the options from the dropdown")
			return;
		case "Java":
			var filename = txtFileName()
			download(opt.value, filename, ".java");
			break;
		case "Excel":
			imp();
			break;
		case "Robot":
			var filename = txtFileName();
			download(opt.value, filename, ".py");
			break;
		case "C#":
			var filename = txtFileName();
			download(opt.value, filename, ".cs");
			break;
	}
}

var download = function(frameworkType, fileName, type) {
	if ((fileName == "Please Write File Name") || (fileName == "")) {
		alert("Please write the file Name")
		return;
	}
	var rowLength = $("#elemetTable tr").length;
	if (rowLength < 4) {
		alert("No entries in the grid to create code at this moment")
		return;
	}
	let temp = document.createElement('a');
	temp.id = 't';
	temp.style.height = 0;
	document.body.appendChild(temp);
	var file = new Blob([templateToGenerate(frameworkType, fileName)], {
		type: 'text/plain'
	});
	temp.href = URL.createObjectURL(file);
	temp.download = fileName + type;
	let selector = document.querySelector('#t');
	selector.click();
	document.body.removeChild(temp)
}

function templateToGenerate(frameworkType, klassName) {
	var data = "";
	var rowData = readingDataFromExcelForCode(frameworkType);
	rowData.forEach(function(value) {
		data = data + value + "\n" + "\n";
	});
	if (frameworkType == "Java") {
		return javaklassTemplate(data, klassName)
	}
	if (frameworkType == "Robot") {
		return robotklassTemplate(data)
	}
	if (frameworkType == "C#") {
		return csharpklassTemplate(data, klassName)
	}

}

function readingDataFrom() {
	pomXPathsAll = [];
	$("#elemetTable tr").each(function(i) {
		if (i > 1) {
			var tempData = new Object();
			$(this).children().each(function(j) {
				var count = $("#elemetTable tr").eq(i).children().length;
				if ($("#elemetTable tr").eq(i).children().length - 1 != j) {
					key = $(this).children().eq(0).attr("name");
					value = $(this).children().eq(0).val();
					tempData[key] = value;
				}
			});
			var arr = Object.keys(tempData);
			if (arr.length > 0) {
				pomXPathsAll.push(tempData);
			}
		}
	});
	return pomXPathsAll;
}

function pushData(params, cb) {
	$.ajax({
		url: 'http://gateway.kuaipu.com.cn/gen/testelementinfo/batchSubmit',
		type: 'post',
		dataType: 'json',
		contentType: 'application/json; charset=UTF-8',
		data: JSON.stringify(params),
		success: function(res) {
			if (typeof(cb) == "function") {
				cb(res);
			}
		},
		error: function(res) {
			alert(res.responseText);
		}
	});
}

function pushDataCallback(res) {
	try {
		if (res.success == true) {
			alert(res.msg);
		}
	} catch (e) {
		alert(JSON.stringify(res));
	}
}

function readingDataFromExcelForCode(frameworkType) {
	pomXPathsAll = [];
	$("#elemetTable tr").each(function(i) {
		var tempData = [];
		if (i >= 1) {
			$(this).children().each(function(j) {
				if ($("#elemetTable tr").eq(i).children().length - 1 != j) {
					value = $(this).children().eq(0).val()
					tempData.push(value);
				}
			});
			if (frameworkType == "Robot") {
				pomXPathsAll.push("${myCode." + tempData[1] + "}" + "       " + "xpath:" + tempData[2] + "\n");
			} else if (frameworkType == "Java") {
				pomXPathsAll.push(tempData[3] + "\n" + "public WebElement  " + tempData[1] + ";");
			} else if (frameworkType == "C#") {
				pomXPathsAll.push("[FindsBy(How = How.XPath, Using = \"" + tempData[2] + "\")]" +
					"\n" + "public IWebElement  " + tempData[1] + ";");
			} else {
				pomXPathsAll.push(tempData[1]);
			}
		}
	});
	pomXPathsAll.pop();
	pomXPathsAll.shift()
	return pomXPathsAll;
}

var javaklassTemplate = function(data, klassName) {
	var klass = "/* Auto Generated by TruePath Ultimate Version 1.0.0 */\n" +
		"\n" +
		"import org.openqa.selenium.support.FindBy;" + "\n" +
		"import org.openqa.selenium.WebElement;" + "\n\n\n" +
		"public class " + klassName + "{" + "\n\n\n" +
		data + "\n\n" +
		"}"
	return klass;
}

var robotklassTemplate = function(data) {
	var klass = "*** Auto Generated by TruePath Ultimate Version 1.0.0 ***\n" +
		"\n" +
		"*** Settings ***" + "\n" +
		"*** Documentation of the web application page object ***" + "\n\n" +
		"*** Variables ***" + "\n" +
		data + "\n\n"
	return klass;
}

var csharpklassTemplate = function(data, klassName) {
	var klass = "// Auto Generated by TruePath Ultimate Version 1.0.0 \n" +
		"\n" +
		"using OpenQA.Selenium;" + "\n" +
		"using OpenQA.Selenium.Support.PageObjects;" + "\n" +
		"using OpenQA.Selenium.Support.UI;" + "\n" +
		"using System;" + "\n\n" +
		"public class " + klassName + "{" + "\n\n\n" +
		data + "\n\n" + "}"
	return klass;
}

/**********************MouseOverCode***************************/
function buttonMouseHover(ele) {
	ele.style.backgroundColor = "rgb(92, 188, 210)";
}

function buttonMouseOut(ele) {
	ele.style.backgroundColor = "";
	ele.style.color = "";
	ele.style.outline = "";
}

function buttonMouseHoverYello(ele) {
	ele.style.backgroundColor = "rgb(225, 228, 44)";
}

function buttonMouseHoverRed(ele) {
	ele.style.backgroundColor = "rgb(214, 65, 65)";
}

/**********************MouseOverCode***************************/
